﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;
namespace AnyOffice.general.system.menu
{
    public partial class _new : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                this.pnlMain.Visible = false;
                SysMenuDao dao = new SysMenuDao();
                if (dao.SelectByMenuId(base.Conn, this.txtMenuId.Value).Rows.Count > 0)
                {
                    this.litMessage.Text = base.ShowPrompt("菜单ID已存在！", "new.aspx");
                }
                else
                {
                    SysMenuData data = new SysMenuData();
                    data.MenuId = this.txtMenuId.Value;
                    data.MenuName = this.txtMenuName.Value;
                    data.Image = this.txtImage.Value;
                    dao.Insert(base.Conn, data);
                    this.litMessage.Text = base.ShowMessage("增加成功！") + "<script>parent.menu_list.location.reload();</script>";
                }
            }
        } 

    }
}
